﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace VisualizadorTabela
{
    public partial class VizualizarResultadosTabelaPrograma : Form
    {
        public VizualizarResultadosTabelaPrograma()
        {
            InitializeComponent();
        }

        private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            switch (openFileDialog1.ShowDialog())
            {
                case DialogResult.Abort:
                    break;
                case DialogResult.Cancel:
                    break;
                case DialogResult.Ignore:
                    break;
                case DialogResult.No:
                    break;
                case DialogResult.None:
                    break;
                case DialogResult.Retry:
                    break;
                case DialogResult.OK:
                case DialogResult.Yes:
                    var xs = new System.Xml.Serialization.XmlSerializer(typeof(LGPeWJNM.BatchProcessBranchAndCut.Resultados[]));
                    using (var stream = System.Xml.XmlReader.Create(openFileDialog1.FileName))
                    {
                        var resultados = xs.Deserialize(stream) as LGPeWJNM.BatchProcessBranchAndCut.Resultados[];
                        //var q = from r in resultados
                        //        select new { Classe = r.Id.Classe, Instancia = r.Id.Instancia, Rotas = r.Refino.Select(s => string.Join(", ", s.Select(s1 => s1.Id))) };
                        //var q1 = from r in q
                        //         from l in r.Rotas
                        //         select new { r.Classe, r.Instancia, Caminhao = r.Rotas.ToList().IndexOf(l) + 1, Rota = l };
                        //dataGridView1.DataSource = q1.ToArray();
                    }
                    break;
                default:
                    break;
            }

        }
    }
}
